package com.aftersale.demo.entity;

import com.aftersale.demo.utils.ValidGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;

/**
*@Author  空
*@Date    2023/10/23 20:17
*@Desc
*/
@TableName(value ="problem")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.aftersale.demo.entity.Problem",description = "售后问题")
public class Problem implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键")
    private Integer id;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "提交客户id")
    private Integer userId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "对应项目")
    private Integer projectId;

    @ApiModelProperty(value = "项目名")
    @TableField(exist = false)
    private String name;
    /**
     * 问题描述
     */
    @NotBlank(message = "问题不能为空",groups = {ValidGroup.ProblemDescription.class})
    @Size(max = 255,min = 0,message = "超出最大描述限制",groups = {ValidGroup.ProblemDescription.class})
    @ApiModelProperty(value = "问题描述")
    private String problemDescription;

    /**
     * 状态
     */
    @NotBlank(message = "状态不能为空",groups = {ValidGroup.State.class})
    @Size(max = 20,min = 0,message = "状态不合法",groups = {ValidGroup.State.class})
    @ApiModelProperty(value = "状态")
    private String state;

    /**
     * 评价
     */
    @NotNull(message = "评价不能为空",groups = {ValidGroup.Evaluate.class})
    @Digits(integer=10,fraction=0,message="字段必须为整数",groups = {ValidGroup.Evaluate.class})
    @Max(value = 10,message = "评价应为1-10的数字",groups = {ValidGroup.Evaluate.class})
    @Min(value = 1,message = "评价应为1-10的数字",groups = {ValidGroup.Evaluate.class})
    @ApiModelProperty(value = "客户评价")
    private Integer evaluate;

    /**
     * 问题提出时间
     */
    @ApiModelProperty(value = "问题提出时间")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date createDate;

    /**
     * 上一次修改时间
     */
    @ApiModelProperty(value = "问题修改时间")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "问题附件")
    private String url;

    @TableField(exist = false)
    private MultipartFile file;

    @TableField(exist = false)
    private Solve solve;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}